<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>网站后台管理模版</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/admin/css/admin.css"/>
</head>

<body>
<div class="page-content-wrap">
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">用章审批</li>
            <li>资金审批</li>
            <li>合同审批</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form" style="width: 90%;padding-top: 20px;" id="yongzhang">
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题：</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">申请人：</label>
                        <div class="layui-input-block">
                            <input type="text" name="apply" required lay-verify="required" placeholder="输入申请人"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公章类型：</label>
                        <div class="layui-input-block">
                            <select name="seal_type" lay-verify="required">
                                <option value="人事章">人事章</option>
                                <option value="财务章">财务章</option>
                                <option value="合同章">合同章</option>
                                <option value="发票章">发票章</option>
                                <option value="法人章">法人章</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">选择流程：</label>
                        <div class="layui-input-block">
                            <select name="flowId" lay-verify="required">
                                <option value="1">用章流程1：部长->经理</option>
                                <option value="1">用章流程2：经理->部长->董事长</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">紧急情况：</label>
                        <div class="layui-input-block">
                            <input type="radio" name="urgent" value="不紧急" title="不紧急" checked>
                            <input type="radio" name="urgent" value="紧急" title="紧急">
                        </div>

                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">使用原因：</label>
                        <div class="layui-input-block">
                            <textarea name="reason" placeholder="输入使用原因" class="layui-textarea"></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="yongzhang">发起审批</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="layui-tab-item">
                <form class="layui-form" style="width: 90%;padding-top: 20px;" id="zijin">
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题：</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">申请人：</label>
                        <div class="layui-input-block">
                            <input type="text" name="apply" required lay-verify="required" placeholder="输入申请人"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">申请金额：</label>
                        <div class="layui-input-block">
                            <input type="text" name="account" required lay-verify="required|number" placeholder="￥"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">选择流程：</label>
                        <div class="layui-input-block">
                            <select name="flowId" lay-verify="required">
                                <option value="2">用章流程1：部长->经理</option>
                                <option value="2">用章流程2：经理->部长->董事长</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">紧急情况：</label>
                        <div class="layui-input-block">
                            <input type="radio" name="urgent" value="不紧急" title="不紧急" checked>
                            <input type="radio" name="urgent" value="紧急" title="紧急">
                        </div>

                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">使用原因：</label>
                        <div class="layui-input-block">
                            <textarea name="reason" placeholder="输入使用原因" class="layui-textarea"></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="zijin">发起审批</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="layui-tab-item ">
                <form class="layui-form" style="width: 90%;padding-top: 20px;" id="hetong">
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题：</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">申请人：</label>
                        <div class="layui-input-block">
                            <input type="text" name="apply" required lay-verify="required" placeholder="输入申请人"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">签约对方：</label>
                        <div class="layui-input-block">
                            <input type="text" name="toward" required lay-verify="required" placeholder="输入签约对方"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">选择流程：</label>
                        <div class="layui-input-block">
                            <select name="flowId" lay-verify="required">
                                <option value="3">用章流程1：部长->经理</option>
                                <option value="3">用章流程2：经理->部长->董事长</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">紧急情况：</label>
                        <div class="layui-input-block">
                            <input type="radio" name="urgent" value="不紧急" title="不紧急" checked>
                            <input type="radio" name="urgent" value="紧急" title="紧急">
                        </div>

                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">合同内容：</label>
                        <div class="layui-input-block">
                            <textarea name="reason" placeholder="输入合同内容" class="layui-textarea"></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="hetong">发起审批</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="../../static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/admin/js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery-1.7.2.min.js"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form();
        form.on('submit(yongzhang)', function (data) {
            var load_index = layer.load(0, {shade: [0.2, '#393D49']});
            data.field.appendix = JSON.stringify(data.field);
            $.ajax(ip + 'flow/postFlow', {
                dataType: 'json',
                type: 'post',
                data: data.field
            }).done(function (data) {
                layer.close(load_index);
                if (data.code == '0') {
                    layer.alert(data.message, {
                        icon: 1,
                        title: "提示",
                        yes: function (index, layero) {
                            layer.close(index);
                            $('button[type="reset"]').click();
                        }
                    });
                } else {
                    layer.alert(data.message, {
                        icon: 5,
                        title: "提示"
                    });
                }
            })
            return false;
        });
        form.on('submit(zijin)', function (data) {
            var load_index = layer.load(0, {shade: [0.2, '#393D49']});
            data.field.appendix = JSON.stringify(data.field);
            $.ajax(ip + 'flow/postFlow', {
                dataType: 'json',
                type: 'post',
                data: data.field
            }).done(function (data) {
                layer.close(load_index);
                if (data.code == '0') {
                    layer.alert(data.message, {
                        icon: 1,
                        title: "提示",
                        yes: function (index, layero) {
                            layer.close(index);
                            document.getElementsByTagName('form')[1].reset();
                            form.render();
                        }
                    });
                } else {
                    layer.alert(data.message, {
                        icon: 5,
                        title: "提示"
                    });
                }
            })
            return false;
        });
        form.on('submit(hetong)', function (data) {
            var load_index = layer.load(0, {shade: [0.2, '#393D49']});
            data.field.appendix = JSON.stringify(data.field);
            $.ajax(ip + 'flow/postFlow', {
                dataType: 'json',
                type: 'post',
                data: data.field
            }).done(function (data) {
                layer.close(load_index);
                if (data.code == '0') {
                    layer.alert(data.message, {
                        icon: 1,
                        title: "提示",
                        yes: function (index, layero) {
                            layer.close(index);
                            document.getElementsByTagName('form')[2].reset();
                            form.render();
                        }
                    });
                } else {
                    layer.alert(data.message, {
                        icon: 5,
                        title: "提示"
                    });
                }
            })
            return false;
        });
    });
</script>
</body>

</html>